<div class="portlet box grey">
    <div class="portlet-title">
        <div class="caption"><i class="icon-reorder"></i>
            Үйлдвэрлэгч
            <a class="btn green" href="<?php echo url_for('@manufacturer_add') ?>"><span class="icon-plus"> Нэмэх</span></a>
        </div>
        <div class="tools">
            <a href="javascript:;" class="collapse"></a>
        </div>
    </div>

    <div class="portlet-body">
        <form method="get" class="form-horizontal">
            <div class="control-group">
                <label class="control-label">Төлөв :</label>
                <div class="controls">
                    <select name="isActive">
                        <option value="0">Бүгд</option>
                        <option value="<?php echo ManufacturerTable::ACTIVE ?>" <?php echo $isActive == ManufacturerTable::ACTIVE ? 'selected' : '' ?>>Идэвхтэй</option>
                        <option value="<?php echo ManufacturerTable::PASSIVE ?>" <?php echo $isActive != null && $isActive == ManufacturerTable::PASSIVE ? 'selected' : '' ?>>Устсан</option>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <button type="submit" class="btn btn-primary">
                        <i class="icon-filter icon-white"></i> Шүүх
                    </button>
                </div>
            </div>
        </form>

        <div class="widget-box">
            <div class="widget-title">
            </div>
            <div class="widget-content nopadding">
                <table class="table table-bordered data-table">
                    <thead>
                        <tr>
                            <th>Үйлдэл</th>
                            <th>Нэр</th>
                            <th>Төлөв</th>
                            <th>Үүсгэсэн</th>
                            <th>Үүсгэсэн огноо</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (count($rows)): ?>
                            <?php foreach ($rows AS $row): ?>
                                <tr>
                                    <td class="center" width="140">
                                        <?php echo link_to('<i class="icon-pencil tip-bottom"> Засах</i>', url_for('@manufacturer_edit?id=' . $row->id), array('class' => 'btn mini green')) ?>
                                        <?php if ($row->is_active == CategoryTable::ACTIVE): ?>
                                            <?php echo link_to('<i class="icon-trash tip-bottom"> Устгах</i>', '@manufacturer_delete?id=' . $row->id, array('confirm' => 'Та устгахдаа итгэлтэй байна уу?', 'class' => 'btn mini red')) ?>
                                        <?php elseif ($row->is_active == CategoryTable::PASSIVE): ?>
                                            <?php echo link_to('<i class="icon-refresh tip-bottom"> Сэргээх</i>', '@manufacturer_restore?id=' . $row->id, array('confirm' => 'Та сэргээхдээ итгэлтэй байна уу?', 'class' => 'btn mini blue')) ?>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php echo $row->name ?>
                                    </td>
                                    <td width="120">
                                        <?php if ($row->is_active == ManufacturerTable::ACTIVE): ?>
                                            <span class="label label-success">Идэвхтэй</span>
                                        <?php elseif ($row->is_active == ManufacturerTable::PASSIVE): ?>
                                            <span class="label label-important">Идэвхгүй</span>
                                        <?php endif; ?>
                                    </td>
                                    <td class="center">
                                        <?php echo UserTable::getFullname($row->created_user_id) ?>
                                    </td>
                                    <td width="140">
                                        <?php echo $row->created_at ?>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <tr>
                                <td>Ангилал олдсонгүй</td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                    <tfoot>
                        <tr>
                            <th colspan="5">Нийт <?php echo count($rows) ?> ангилал байна</th>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</div>
